package com.cskaoyan.converter;

import com.cskaoyan.bean.Cart;
import org.mapstruct.Mapper;
import com.cskaoyan.bean.OrderGoods;
import com.cskaoyan.bean.vo.WxOrderGoodsListInfo;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public interface OrderGoodsConverter {
    @Mappings({
            @Mapping(source = "number", target = "number"),
            @Mapping(source = "picUrl", target = "picUrl"),
            @Mapping(source = "orderId", target = "id"),
            @Mapping(source = "goodsName", target = "goodsName"),
    })
    WxOrderGoodsListInfo OrderGoods2Info(OrderGoods orderGoods);

    List<WxOrderGoodsListInfo> OrderGoods2Info(List<OrderGoods> orderGoods);
    @Mappings({
            @Mapping(source = "goodsId", target = "goodsId"),
            @Mapping(source = "goodsName", target = "goodsName"),
            @Mapping(source = "goodsSn", target = "goodsSn"),
            @Mapping(source = "productId", target = "productId"),
            @Mapping(source = "number", target = "number"),
            @Mapping(source = "price", target = "price"),
            @Mapping(source = "specifications", target = "specifications"),
            @Mapping(source = "picUrl", target = "picUrl"),
    })
    OrderGoods cart2OrderGoods(Cart cart);
    List<OrderGoods> cart2OrderGoods(List<Cart> carts);
}
